{extend name="admin@public/base" /}
 
{block name="main-content"}
<div class="page-content">
     <div class="row">
        <div class="col-xs-12">
           <div class="well with-header  with-footer" style="padding-top:50px; zoom:1; overflow:hidden">
             <form class="form-horizontal" name="add_cate" id="add_cate" method="post" action="{:url('edit')}">
                        <div class="col-sm-12" >
                        
                        <div class="col-sm-4" style="padding-left:0" >
                        <div class="form-group">
                            <label class="col-sm-3 control-label">选择目录：</label>
                            <div class="input-group col-sm-8">
                              <select name="mbdir" id="mbdir" class="form-control" >
                              {foreach name="jpath" item="jt"}
                                  <option value="{:base64_encode($jt)}" {if condition="$kpath eq $jt"}selected{/if}>{$jt}</option>
                              {/foreach}
                              </select>
                            </div>
                        </div>
                        </div> 
                        <div class="col-sm-4" >
                        <div class="form-group">
                            <label class="col-sm-5 control-label">模板名称（非中文）：</label>
                            <div class="input-group col-sm-6">
                                 <input type="hidden" value="{$id}" name="id" id="id" />
                                 <input id="name" type="text" class="form-control" name="name" value="{$file_name}" placeholder="不需另加后缀,系统自动添加.html" >
                            </div>
                        </div>
                        </div>
                        
                        </div>
                        
                        
                        <div class="col-sm-12" style="border-top:dashed 1px #dedede; padding-top:10px">

                                <div class="col-sm-1" style="text-align: right;padding-right:25px" >
                                <br/><br/><br/>模板内容：
                                </div>
                           
                                <div class="col-sm-9" >
                                   <div class="form-group">
                                           <textarea id="content" name="content">{$content}</textarea>
   
                                    
   <link rel="stylesheet" href="__PUBLIC__/CodeMirror/codemirror.css">
   <link rel="stylesheet" href="__PUBLIC__/CodeMirror/theme/mdn-like.css">
   <script type="text/javascript" src="__PUBLIC__/CodeMirror/codemirror.js"></script>
   <script type="text/javascript" src="__PUBLIC__/CodeMirror/xml.js"></script>
   <script type="text/javascript" src="__PUBLIC__/CodeMirror/javascript.js"></script>
   
    
   <script type="text/javascript">
   
       var mirror_area = document.getElementById("content");
       var mirror_option = {
           mode: "text/html",
           lineNumbers   :true,//显示行号
           indentUnit    :8,//缩进空格数
           smartIndent   :true,//智能缩进
           theme         :"mdn-like",//主题
   
           matchBrackets :true,
           gutter        :true,
           fixedGutter   :true,
           indentWithTabs:true,
           readOnly      :false,
           lineWrapping  :true,
           height        :500,
           enterMode     :"keep",
           tabMode       :"shift"
       };
       
       var mirror = CodeMirror.fromTextArea(mirror_area, mirror_option);

        
       mirror.onChange = function(){
          $("#content").val(mirror.getValue());
       }
       mirror.refresh();	


   $(function(){	    
       $(".ty_tags a").click(function(){
             var d = $(this).parent().attr('data');
             var f = $(this).html();
             f = f.replace('&lt;','<');
             f = f.replace('&gt;','>');
             mirror.replaceSelection(f);  
       });	
   });
   </script>
                                  </div>
                                </div>
                           </div>


                           
                        <div class="space-4"></div>

                        <div class="clearfix form-actions">
                            <div class="col-md-offset-3 col-md-9">
                                 
                                 
                                <button class="btn btn-info" type="submit">
                                    <i class="ace-icon fa fa-check bigger-110"></i>
                                    保存
                                </button>
    
                                &nbsp; &nbsp; &nbsp;
                                <button class="btn" type="reset">
                                    <i class="ace-icon fa fa-undo bigger-110"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                       </form>
                   
                   </div>
               </div>
   
           </div>
       </div><!-- /.page-content -->
   {/block}